package com.yc.entities;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * <p>
 * 患者信息表
 * </p>
 *
 * @author kuakha
 * @since 2021-04-12
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "BloodSugarPatientInfo对象", description = "患者信息表")
public class BloodSugarPatientInfo extends Model<BloodSugarPatientInfo> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "患者信息表id")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "用户信息对应的院长id")
//    @NotEmpty(message = "用户信息对应的院长id不能为空")
    private Integer deanId;

    @ApiModelProperty(value = "用户姓名")
    private String username;

    @ApiModelProperty(value = "患者头像")
    private String patientIcon;

    @ApiModelProperty(value = "用户性别")
    private String sex;

    @ApiModelProperty(value = "用户身份证号")
    private String idCard;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME)
    @ApiModelProperty(value = "用户生日")
    private Date brithday;

    @ApiModelProperty(value = "手机号")
    private String phone;

    @ApiModelProperty(value = "住院号")
    private String hospitalNum;

    @ApiModelProperty(value = "对应科室表唯一id")
    private Integer departmentId = 0;

    @ApiModelProperty(value = "对应医生表唯一id")
    private Integer doctorId;

    @ApiModelProperty(value = "对应床位表唯一id")
    private Integer bedId;

    @ApiModelProperty(value = "糖尿病类型")
    private String sugarType;

    @ApiModelProperty(value = "身高")
    private Double height = 0.0;

    @ApiModelProperty(value = "体重")
    private Double weight = 0.0;

    @ApiModelProperty(value = "糖化值")
    private Double sugarNum = 0.0;

    @ApiModelProperty(value = "出院糖化值")
    private Double outSugarNum = 0.0;

    @ApiModelProperty(value = "出入院状态  0:未出院  1:已出院")
    private String theHospitalStatus;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone = "Asia/Shanghai")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm", iso = DateTimeFormat.ISO.DATE_TIME)
    @TableField(value = "tohospital_time", fill = FieldFill.INSERT)
    @ApiModelProperty(value = "住院时间")
    private Date toHospitalTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd", iso = DateTimeFormat.ISO.DATE_TIME)
    @ApiModelProperty(value = "出院时间")
    private Date outHospitalTime;

    @TableField(exist = false)
    @ApiModelProperty(value = "关注患者  true:关注  false:取关")
    private Boolean isConcernsUser = false;

    @TableField(exist = false)
    @ApiModelProperty(value = "权限id")
    private String preId;

    @TableField(exist = false)
    @ApiModelProperty(value = "医生姓名")
    private String doctor_name;

    @TableField(exist = false)
    @ApiModelProperty(value = "床位号")
    private String bed_num;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
